FROM ruby:3.0-alpine

RUN apk add --update --no-cache \
        build-base \
        curl-dev \
        git \
        nodejs \
        shared-mime-info \
        sqlite-dev \
        tzdata \
        yaml-dev \
        yarn \
        zlib-dev

RUN mkdir /app /gem
WORKDIR /app

RUN gem update --system 3.5.7
RUN bundle config force_ruby_platform true
RUN gem install rails -v 7.1.3.2
RUN rails new .

COPY . /gem
RUN bundle add meta_request --path /gem
RUN bundle install

COPY res/routes.rb /app/config/
COPY res/dummy_controller.rb /app/app/controllers/
COPY res/dummy /app/app/views/dummy
COPY res/meta_request_test.rb /app/test/integration/

RUN bundle exec rails db:migrate

ENV PARALLEL_WORKERS 1

CMD ["bin/rake"]
